package mc747.portal.logicas;

import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import mc747.portal.servlet.Logica;
import mc747.servicos.clientes.Builder;
import mc747.servicos.clientes.Cliente;

public class ConsultaCliente implements Logica {

	public void executa(HttpServletRequest req, HttpServletResponse res)
			throws Exception {
		//Falta colocar as chamadas do web services aqui
		int cpf = Integer.parseInt(req.getParameter("cpf"));
		Cliente cli = Builder.consultaDados(cpf);
		req.setAttribute("cep", cli.getCep());
		req.setAttribute("complemento", cli.getComplemento());
		req.setAttribute("cpf", cli.getCpf());
		req.setAttribute("datanascimento", cli.getDatanascimento());
		req.setAttribute("ddd", cli.getDdd());
		req.setAttribute("email", cli.getEmail());
		req.setAttribute("id", cli.getId());
		req.setAttribute("nome", cli.getNome());
		req.setAttribute("telefone", cli.getTelefone());
		RequestDispatcher rd = req.getRequestDispatcher(req.getParameter("fwd"));
		rd.forward(req, res);

	}


}
